package com.house.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.house.mapper.AdminMapper;
import com.house.pojo.Admin;
import com.house.pojo.AdminExample;
import com.house.pojo.AdminExample.Criteria;
import com.house.service.AdminService;

@Service
public class AdminServiceImpl implements AdminService {
	@Autowired
	private AdminMapper adminMapper;
	@Override
	public Admin findAdminByIdandpassword(String adminId, String password) throws Exception {
		AdminExample example = new AdminExample();
		Criteria criteria = example.createCriteria();
		criteria.andAdminIdEqualTo(adminId);
		criteria.andAdminPasswordEqualTo(password);
		List<Admin> adminlist = adminMapper.selectByExample(example);
		if(adminlist !=null & adminlist.size() > 0){
			Admin admin = adminlist.get(0);
			return admin;
		}
		return null;
		
	}

}
